<?php
namespace Admin\Model;

use Think\Model;

class AdminModel extends Model{

    //     protected $connection = 'DB_CONFIG2';
    //     protected $tablePrefix = 'ty_';
    
    /**
     * 查找admin的账号
     * @param unknown $where
     */
    public function find_admin($where){
        if(isset($where)){
            $result = $this->where($where)->find();
        }else{
            $result = $this->where($where)->select();
        }
        return $result;
    }
    
    public function select_admin($where){
        $result = $this->where($where)->select();
        return $result;
    }
    
    /**
     * 删除管理员
     * @param unknown $where
     */
    public function deleteAdmin($where){
        if(empty($where)){
            return false;
        }
        $result = $this->where($where)->delete();
        if($result){
            return true;
        }else{
            return false;
        }
        
    }
    
    /**
     * 修改管理员信息
     * @param unknown $where
     * @param unknown $data
     */
    public function update_admin($where,$data){
        $result = $this->where($where)->save($data);
        if($result){
            return true;
        }else{
            return false;
        }
    }
}

?>